<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Featured extends MX_Controller {

	
	function __construct()
	{
		parent::__construct();
		$this->load->model('listing/listing_model');
		$this->load->model('location/location_model');
		$this->load->model('category/category_model');				
	}

	function showListing( $pID=0,$city=0,$limit=3){
		
		//if($featured == 0){
		
		
				$sql = "SELECT DISTINCT t1.title, t1.* FROM profile AS t1
				INNER JOIN term AS t2 ON t1.id = t2.listing_id
				WHERE t2.term =  'key'
				AND t2.term_value =  $pID and featured = 1 LIMIT $limit" ;
			
			
			
	//	}
		$data['featued'] = $this->db->query($sql)->result();
		
		
		
		$this->load->view('featured',$data);
		
	}
	
	function showHomePage($limit=0){
		$sql = "select * from profile where featured = 1 order by RAND()  limit $limit";
		$data['featued'] = $this->db->query($sql)->result();
	
		$this->load->view('featured_home_page',$data);
	
	}
	
}
/* End of file */
